window.onload = function () {
	var authCodeBtn = document.querySelector('.code-btn>a');
	var popup = document.querySelector('.popup');
	var popupClose = document.querySelector('.popup>.wrap-2');
	var timer = 60;
	var clicked = true;
	authCodeBtn.addEventListener('click',function (e) {
		e.preventDefault();	
		if(clicked == true){
			popup.style.display = 'block';
			count();
			setTimeout( function () {
				popup.style.display = 'none';
			},1000);
		}
	});
	
	
	
	function count () {
		clicked = false;
		if(timer>1){
			timer--;
			authCodeBtn.innerHTML = '剩余<em class="red-num">' + timer + '</em>' + '秒';		
			setTimeout(count,1000);
		} else {
			authCodeBtn.innerHTML = '获取验证码';
			clicked = true;
			timer = 60;
		}
	}
	
}
